/**
 * 
 */
package sqs.model;

import java.util.ArrayList;
import java.util.List;


/**
 * @author kjleng
 *
 */
public class RatingQuestion extends Question {
	private List<RatingQuestionAnswer> ratingQuestionAnswers = new ArrayList<RatingQuestionAnswer>();
	private List<RatingOption> options = new ArrayList<RatingOption>();
        
	public void addAnswer(Answer ans){
		ratingQuestionAnswers.add((RatingQuestionAnswer)ans);
		answered = true;
	}
	
	public List<RatingQuestionAnswer> getRatingQuestionAnswers() {
		return ratingQuestionAnswers;
	}

	public void setRatingQuestionAnswers(
		List<RatingQuestionAnswer> ratingQuestionAnswers) {
		this.ratingQuestionAnswers = ratingQuestionAnswers;
	}
        
	public Answer createAnswer(){
		return new RatingQuestionAnswer();
	}
	
	public List getOptions(){
		return options;
	}
        
	public void setOptions(List options) {
		this.options = (List<RatingOption>)options;
	}

	public Option createOption(){
		return new RatingOption();
	}

	public Scale createScale(){
		return new Scale();
	}
        
	public int getNumOfRespondents(){
		return ratingQuestionAnswers.size();
	}
        
	public List getAnswers(){
		return ratingQuestionAnswers;
	}
        
        // Added by Joko 18/01/2008
        public String getReportOrder() {
                return null;
        }
        
        // Added by Joko 18/01/2008
        public void setReportOrder(String reportOrder) {
                // do nothing
        }

        // Added by Joko 18/01/2008
        public RatingOption getOptionById(int optionId) {
                for(RatingOption ro : options) {
                        if(ro.getOptionId()==optionId)
                                return ro;
                }
                return null;
        }        
}
